package com.dubious.interview.euler;

public class Problem1 {

    /**
     * If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and
     * 9. The sum of these multiples is 23.
     * 
     * @param args
     */
    public static void main(String[] args) {
        // there are 333 multiples of 3 under 1000, with the mean being the value of the 167th
        // element
        int multiplesOf3 = 333 * (167 * 3);
        // there are 199 multiples of 5 under 1000, with the mean being the value of the 100th
        // element
        int multiplesOf5 = 199 * (100 * 5);
        // there are 66 multiples of15 under 1000, with the mean being the mean of the 33rd and 34th
        // elements
        int multiplesOf15 = 66 * ((33 * 15) + (34 * 15)) / 2;

        // 233168
        System.out.println("Values is: " + (multiplesOf3 + multiplesOf5 - multiplesOf15));
    }
}
